var emojis={
    "[18禁]":'18',
    "[666]":'666',
    "[爱心]":'aixin',
    "[拜托]":'baituo',
    "[抱抱]":'baobao',
    "[闭嘴]":'bizui',
    "[便便]":'bianbian',
    "[擦汗]":'cahan',
    "[菜刀]":'caidao',
    "[差评]":'chaping',
    "[吃瓜]":'chigua',
    "[抽烟]":'chouyan',
    "[唇]":'wen',
    "[呲牙]":'ciya',
    "[打脸]":'dalian',
    "[大叫]":'dajiao',
    "[大吐]":'datu',
    "[大笑]":'daxiao',
    "[得意]":'deyi',
    "[瞪眼]":'dengyan',
    "[嘟]":'du',
    "[耳机]":'erji',
    "[发呆]":'fadai',
    "[发怒]":'fanu',
    "[飞吻]":'feiwen',
    "[粉]":'fen',
    "[尴尬]":'ganga',
    "[高兴]":'gaoxing',
    "[搞定]":'gaoding',
    "[给力]":'geili',
    "[狗]":'gou',
    "[鼓掌]":'guzhang',
    "[关注]":'guanzhu',
    "[鬼脸]":'guilian',
    "[哈欠]":'haqian',
    "[害怕]":'haipa',
    "[害羞]":'haixiu',
    "[汗]":'han',
    "[喝彩]":'hecai',
    "[互粉]":'hufen',
    "[黄狗]":'huanggou',
    "[黄瓜]":'huanggua',
    "[灰狗]":'huigou',
    "[加油]":'jiayou',
    "[见钱]":'jianqian',
    "[惊恐]":'jingkong',
    "[纠结]":'jiujie',
    "[拒绝]":'jujue',
    "[开心]":'kaixin',
    "[抠鼻]":'koubi',
    "[口罩]":'kouzhao',
    "[哭]":'ku',
    "[酷]":'ku1',
    "[困]":'kun',
    "[蓝狗]":'langou',
    "[雷]":'lei',
    "[礼物]":'liwu',
    "[脸黑]":'lianhei',
    "[脸红]":'lianhong',
    "[露牙]":'louya',
    "[绿帽]":'lvmao',
    "[卖萌]":'maimeng',
    "[玫瑰]":'meigui',
    "[摸头]":'motou',
    "[拇指]":'muzhi',
    "[啤酒]":'pijiu',
    "[敲打]":'qiaoda',
    "[亲]":'qin',
    "[色]":'se',
    "[伤心]":'shangxin',
    "[生气]":'shengqi',
    "[生日]":'shengri',
    "[胜利]":'shengli',
    "[衰]":'shuai',
    "[睡]":'shui',
    "[思考]":'sikao',
    "[疼]":'teng',
    "[调皮]":'tiaopi',
    "[吐]":'tu',
    "[吐舌]":'tushe',
    "[吐血]":'tuxue',
    "[威武]":'v5',
    "[微笑]":'weixiao',
    "[握手]":'wushou',
    "[无奈]":'wunai',
    "[无语]":'wuyu',
    "[捂嘴]":'wuzui',
    "[喜欢]":'xihuan',
    "[吓]":'xia',
    "[想哭]":'xiangku',
    "[笑哭]":'xiaoku',
    "[斜眼]":'xieyan',
    "[心碎]":'xinsui',
    "[嘘]":'xu',
    "[眼泪]":'yanlei',
    "[疑问]":'yiwen',
    "[阴险]":'yinxian',
    "[郁闷]":'yumen',
    "[晕]":'yun',
    "[再见]":'zaijian',
    "[赞]":'zan',
    "[指点]":'zhidian',
    "[嘴]":'zui',
};

function emojiToImg(text) {
    if(text==''){
        return text;
    }
    text = text.replace(/\[.{1,3}\]/g, function() {
        if (arguments.length > 1) {
            if (typeof emojis[arguments[0]] !== "undefined") {
                //return emojis[arguments[0]];
                return '<img class="emoji" src="/static/emoji/img/'+emojis[arguments[0]]+'.png" >';
            }
            return arguments[0]; // 没匹配到就原样返回
        }
    });
    return text;
}